<?php
class Permission
{
	public $Table="permission";
	public $PermissionID;
	public $PermissonName;	
	function loadByKey($id)
	{
		$ob=new ClassConnect();
		$sql="select * from `".$this->Table."` where PermissionID=".$id;
		$row=$ob->singleData($sql);
		$this->PermissionID=$row['PermissionID'];
		$this->PermissonName=$row['PermissonName'];
		
	}
	function getTable($dk)
	{
		$ob=new ClassConnect();
		$sql="select * from `".$this->Table."` $dk";
		$data=$ob->mutiData($sql);
		return $data;
	}
	function travel($dk)
	{
		$arr=array();
		$data=$this->getTable($dk);
		for($i=0;$i<count($data);$i++)
			array_push($arr,$data[$i]['PermissionID']);
		return $arr;
	}
	function insert($conn)
	{
		$ob=new ClassConnect();
		$field=array("PermissionID","PermissonName");
		$value=array($this->PermissionID,$this->PermissionName);
		return $ob->insertData($conn,$this->Table,$field,$value);
	}
	function update($conn)
	{
		$ob=new ClassConnect();
		$field=array("PermissionID","PermissionName");
		$value=array($this->PermissionID,$this->PermissionName);
		$where="PermissionID = '".$this->PermissionID."'";
		return $ob->updateData($conn,$this->Table,$field,$value,$where);			
	}
	
	function delete($conn)
	{
		$ob=new ClassConnect();		
		$where="PermissionID = '".$this->PermissionID."'";
		return $ob->deleteData($conn,$this->Table,$where);
			
	}

}
?>
